package com.example.demo.service.serviceImpl;

import com.example.demo.entity.Refund;
import com.example.demo.mapper.RefundMapper;
import com.example.demo.service.RefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 退款表(Refund)Service层
 *
 * @author 杨丽辉
 * @since 2021-03-18 14:21:46
 */
@Service
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
public class RefundServiceImpl implements RefundService {
        @Autowired
        private RefundMapper refundMapper;


 /**
     * 通过ID和其他条件查询单条数据
     *
     * @param refund 实例对象
     * @return 实例对象
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
     public Refund queryRefundLimit1(Refund refund){
     return  refundMapper.queryRefundLimit1( refund);
     }
     
 /**
     * 查询指定行数据
     * @param refund 实例对象
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public   List<Refund> queryAllRefundByLimit( Refund refund, Integer offset,  Integer limit){
   return refundMapper.queryAllRefundByLimit(refund, offset,limit);
  }

  /**
     * 查询数据条数
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public int countAllRefund(Refund refund){
   return refundMapper.countAllRefund( refund);
   }
   /**
     * 通过实体作为筛选条件查询
     *
     * @param refund 实例对象
     * @return 对象列表
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public List<Refund> queryAllRefund(Refund refund){
   return refundMapper.queryAllRefund(refund);
   }
  /**
     * 新增数据
     *
     * @param refund 实例对象
     * @return 影响行数
     */
     @Override
   @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
    public int insertRefund(Refund refund){
    return  refundMapper.insertRefund( refund);
    }
  /**
     * 修改数据
     *
     * @param refund 实例对象
     * @return 影响行数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
     public  int updateRefund(Refund refund){
         return refundMapper.updateRefund( refund);
     }

    /**
     * 通过主键删除数据
     * @param refundId 主键
     * @return 影响行数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  int deleteRefundById(String refundId){
   return  refundMapper.deleteRefundById( refundId);
   }
     /**
     * 通过主键列表删除，列表长度不能为0
     * @param list 集合
     * @return 条数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public  int deleteRefundByIds( List<String> list){
    return  refundMapper.deleteRefundByIds(  list);
  }
    
       /**
     * 通过主键修改实体列表，列表长度不能为0，注意：当实体属性为null时，对应的列也会别更新为null
     * @param list 集合
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public int updateRefundBatch( List<Refund> list){
   return  refundMapper.updateRefundBatch(list);
   }
    /**
     * 批量其他列,除主键以外的列，列表长度不能为0,字段是空的就置为null
     * @param list 集合
     * @return 条数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
 public   int insertRefundBatch( List<Refund> list){
 return refundMapper.insertRefundBatch( list);
 }
      /**
     * 通过实体非空属性删除
     * @param refund  实体
     * @return 条数
     */
        @Override
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public   int deleteRefundByEntity( Refund refund){
  return  refundMapper.deleteRefundByEntity(  refund);
  }
    /**
     * 通过实体不为空的属性作为筛选条件查询列表
     * @param refund  实体
     * @return list
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  List<Refund> listRefundByEntity(Refund refund){
   return refundMapper.listRefundByEntity( refund);
   }

 /**
     * 新增实体属性不为null的列
     * @param refund  实体
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  int insertRefundSelect( Refund refund){
      return refundMapper.insertRefundSelect( refund);

   }
   
      /**
     * 批量新增新增实体属性不为null的列
     * @param list  实体
     * @return 条数
     */
        @Override
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public  int insertRefundListSelect( List<Refund> list){

     return refundMapper.insertRefundListSelect( list);
      }
     /**
     * 通过实体不为空的属性作为筛选条件查询单个
     * @param refund  实体
     * @return 单个
     */
     @Override
   @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
    public  Refund getRefundByEntity(Refund refund){
     return  refundMapper.getRefundByEntity(refund);
    }

}

